package online.exam.controller;

import online.exam.common.GlobalConstant;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @author 王景煜
 * created in 2019/12/7 13:42
 */

@Controller
@RequestMapping(value = "/teacher-action")
public class TeaActionController {

    @GetMapping("/index")
    public String toIndex() {
        return "admin/index";
    }

    @GetMapping("/student")
    public String manageStudent() {
        return "admin/student";
    }

    @GetMapping("/teacher")
    public String manageTeacher() {
        return "admin/teacher";
    }

    @GetMapping("/clazz")
    public String manageClazz() {
        return "admin/clazz";
    }

    @GetMapping("/test")
    public String manageTest() {
        return "admin/test";
    }

    @GetMapping("/customer-paper")
    public String manageCP() {
        return "admin/customerPaper";
    }

    @GetMapping("/random-paper")
    public String manageRP() {
        return "admin/randomPaper";
    }

    @GetMapping("/details")
    public String result() {
        return "admin/details";
    }

    @GetMapping("/logout")
    public String logout(HttpServletRequest request) {
        HttpSession session = request.getSession();
        session.removeAttribute(GlobalConstant.TEACHER);
        return "redirect:/teacher";
    }

    @GetMapping("/check")
    public String check() {
        return "teacher/index";
    }

    @GetMapping("/check-detail")
    public String checkDetail() {
        return "teacher/details";
    }

    @GetMapping("/setting")
    public String setting() {
        return "admin/public/setting";
    }
}
